package com.kreedx.kdemo.module;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.widget.FrameLayout;

import com.kreedx.kdemo.R;
import com.kreedx.kdemo.common.FragmentFactory;

import butterknife.BindView;
import butterknife.ButterKnife;

public class MainActivity extends AppCompatActivity {

    @BindView(R.id.frame_layout)
    FrameLayout frameLayout;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        ButterKnife.bind(this);

        if(getIntent() != null){
            String name = getIntent().getStringExtra("name");
            getSupportFragmentManager().beginTransaction().add(R.id.frame_layout, FragmentFactory.getFragmentByName(name)).commit();
        }else {
            getSupportFragmentManager().beginTransaction().add(R.id.frame_layout,HomeFragment.newInstance()).commit();

        }



    }
}
